Node2D plugin example

This example shows how to create a custom 2D node VideoView2D in a Kanzi Engine plugin. The VideoView2D node renders video files whose resolution is divisible by 2 and are encoded with the MPEG-4 codec. The VideoView2D node does not play the audio track in video files.

You can find the video file in the Application/bin directory.

The example shows how to use the Kanzi Engine plugins. For Android, a shared image texture utilizing OES_EGL_image_external extension is used for streaming the video from an external context.

You can find the example in the <KanziWorkspace>/Examples/Node2D_plugin directory.

To learn how to create a Kanzi Engine plugin, see Creating Kanzi Engine plugins.

The example runs on Windows and Android platforms:

Using the external texture handle

Because Android’s native code and Kanzi application framework run in different context, they cannot share the GPU resources. A widely available OpenGL extension (GL_TEXTURE_EXTERNAL_OES) provides the support for external texture resources that can be shared between contexts with few limitations. The Node2D_plugin example uses the Android media player to render a video stream to a surface view that is bound to the external texture handle. On the Kanzi side, the texture of the node that renders the video is bound to the same external texture handle, and displayed in the render loop.

You can use this approach on other platforms where:

A typical example is a streaming video.

See also

Kanzi Engine plugins

Creating Kanzi Engine plugins

Examples